# Contributor: Michał Polański <michal@polanski.me>
# Maintainer:
pkgname=pegtl
_pkgname=PEGTL
pkgver=3.2.7
pkgrel=0
pkgdesc="Parsing Expression Grammar Template Library"
url="https://github.com/taocpp/PEGTL"
license="MIT"
arch="noarch"
makedepends="cmake"
subpackages="$pkgname-doc"
source="$_pkgname-$pkgver.tar.gz::https://github.com/taocpp/PEGTL/archive/$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DPEGTL_INSTALL_DOC_DIR=share/doc/$pkgname \
		-DPEGTL_INSTALL_CMAKE_DIR=lib/cmake/$pkgname \
		-DPEGTL_BUILD_TESTS=ON \
		-DPEGTL_BUILD_EXAMPLES=OFF
	cmake --build build
}

check() {
	cd build
	ctest
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

sha512sums="
e996be569e1c25377b13870c4f3e59f1935bbf24bb7c6edca0edc85b304fbe3d05db52a303839b0bd50c78769b773fc2237814787a703c58de8a79398210ee34  PEGTL-3.2.7.tar.gz
"
